//
//  IDCViewController.m
//  server
//
//  Created by iD Student on 7/25/13.
//  Copyright (c) 2013 student. All rights reserved.
//

#import "IDCViewController.h"

@interface IDCViewController ()

@end

@implementation IDCViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSURL *serverURL = [NSURL URLWithString: [[NSString alloc] initWithFormat:@"http://apps.tinytech.us/R7GNJI27I9/?Method=0x01"]];
    NSData *serverResponse = [NSData dataWithContentsOfURL:serverURL];
    NSError *error = nil;
    NSDictionary* json = [NSJSONSerialization
                          JSONObjectWithData:serverResponse
                          options:kNilOptions
                          error:&error];
    
    highScoresName = [json objectForKey:@"Users"];
    highScoresValue = [json objectForKey:@"Score"];
    
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [highScoresName count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    cell.textLabel.text = [highScoresName objectAtIndex:indexPath.row];
    UILabel *scoreLabel = [[UILabel alloc] initWithFrame:CGRectMake(232,11,68,21)];
    scoreLabel.text = [highScoresValue objectAtIndex:indexPath.row];
    [cell addSubview:scoreLabel];
    
    scoreLabel.font = [[UIFont alloc] init];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
}


@end
